home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
listbox.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
17KB
|
330 lines
lllliiiissssttttbbbbooooxxxx((((nnnn)))) TTTTkkkk (((( )))) lllliiiissssttttbbbbooooxxxx((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
listbox - Create and manipulate listbox widgets
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
lllliiiissssttttbbbbooooxxxx _p_a_t_h_N_a_m_e ?_o_p_t_i_o_n_s?
SSSSTTTTAAAANNNNDDDDAAAARRRRDDDD OOOOPPPPTTTTIIIIOOOONNNNSSSS
bbbbaaaacccckkkkggggrrrroooouuuunnnndddd ffffoooorrrreeeeggggrrrroooouuuunnnndddd sssseeeelllleeeeccccttttBBBBaaaacccckkkkggggrrrroooouuuunnnnddddxxxxSSSSccccrrrroooollllllllCCCCoooommmmmmmmaaaannnndddd |
bbbboooorrrrddddeeeerrrrWWWWiiiiddddtttthhhh ffffoooonnnntttt sssseeeelllleeeeccccttttBBBBoooorrrrddddeeeerrrrWWWWiiiiddddtttthhhhyyyySSSSccccrrrroooollllllllCCCCoooommmmmmmmaaaannnndddd|
ccccuuuurrrrssssoooorrrr ggggeeeeoooommmmeeeettttrrrryyyy sssseeeelllleeeeccccttttFFFFoooorrrreeeeggggrrrroooouuuunnnndddd |
eeeexxxxppppoooorrrrttttSSSSeeeelllleeeeccccttttiiiioooonnnn rrrreeeelllliiiieeeeffff sssseeeettttGGGGrrrriiiidddd |
See the ``options'' manual entry for details on the standard
options.
WWWWIIIIDDDDGGGGEEEETTTT----SSSSPPPPEEEECCCCIIIIFFFFIIIICCCC OOOOPPPPTTTTIIIIOOOONNNNSSSS
None.
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The lllliiiissssttttbbbbooooxxxx command creates a new window (given by the
_p_a_t_h_N_a_m_e argument) and makes it into a listbox widget.
Additional options, described above, may be specified on the
command line or in the option database to configure aspects
of the listbox such as its colors, font, text, and relief.
The lllliiiissssttttbbbbooooxxxx command returns its _p_a_t_h_N_a_m_e argument. At the
time this command is invoked, there must not exist a window
named _p_a_t_h_N_a_m_e, but _p_a_t_h_N_a_m_e's parent must exist.
A listbox is a widget that displays a list of strings, one
per line. When first created, a new listbox has no elements
in its list. Elements may be added or deleted using widget
commands described below. In addition, one or more elements
may be selected as described below. If a listbox is |
exporting its selection (see eeeexxxxppppoooorrrrttttSSSSeeeelllleeeeccccttttiiiioooonnnn option), then |
it will observe the standard X11 protocols for handling the
selection; listbox selections are available as type SSSSTTTTRRRRIIIINNNNGGGG,
consisting of a Tcl list with one entry for each selected
element.
For large lists only a subset of the list elements will be
displayed in the listbox window at once; commands described
below may be used to change the view in the window.
Listboxes allow scrolling in both directions using the |
standard xxxxSSSSccccrrrroooollllllllCCCCoooommmmmmmmaaaannnndddd and yyyySSSSccccrrrroooollllllllCCCCoooommmmmmmmaaaannnndddd options. They
also support scanning, as described below.
WWWWIIIIDDDDGGGGEEEETTTT CCCCOOOOMMMMMMMMAAAANNNNDDDD
PPPPaaaaggggeeee 1111 ((((pppprrrriiiinnnntttteeeedddd 7777////22223333////99995555))))
lllliiiissssttttbbbbooooxxxx((((nnnn)))) TTTTkkkk (((( )))) lllliiiissssttttbbbbooooxxxx((((nnnn))))
The lllliiiissssttttbbbbooooxxxx command creates a new Tcl command whose name is
_p_a_t_h_N_a_m_e. This command may be used to invoke various
operations on the widget. It has the following general
form:
_p_a_t_h_N_a_m_e _o_p_t_i_o_n ?_a_r_g _a_r_g ...?
_O_p_t_i_o_n and the _a_r_gs determine the exact behavior of the
command. The following commands are possible for listbox
widgets:
_p_a_t_h_N_a_m_e ccccoooonnnnffffiiiigggguuuurrrreeee ?_o_p_t_i_o_n? ?_v_a_l_u_e _o_p_t_i_o_n _v_a_l_u_e ...?
Query or modify the configuration options of the
widget. If no _o_p_t_i_o_n is specified, returns a list
describing all of the available options for _p_a_t_h_N_a_m_e
(see TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo for information on the format of
this list). If _o_p_t_i_o_n is specified with no _v_a_l_u_e, then
the command returns a list describing the one named
option (this list will be identical to the
corresponding sublist of the value returned if no
_o_p_t_i_o_n is specified). If one or more _o_p_t_i_o_n-_v_a_l_u_e
pairs are specified, then the command modifies the
given widget option(s) to have the given value(s); in
this case the command returns an empty string. _O_p_t_i_o_n
may have any of the values accepted by the lllliiiissssttttbbbbooooxxxx
command.
_p_a_t_h_N_a_m_e ccccuuuurrrrsssseeeelllleeeeccccttttiiiioooonnnn
Returns a list containing the indices of all of the |
elements in the listbox that are currently selected. |
If there are no elements selected in the listbox then |
an empty string is returned.
_p_a_t_h_N_a_m_e ddddeeeelllleeeetttteeee _f_i_r_s_t ?_l_a_s_t?
Delete one or more elements of the listbox. _F_i_r_s_t and
_l_a_s_t give the integer indices of the first and last
elements in the range to be deleted. If _l_a_s_t isn't
specified it defaults to _f_i_r_s_t, i.e. a single element
is deleted. An index of 0000 corresponds to the first
element in the listbox. Either _f_i_r_s_t or _l_a_s_t may be
specified as eeeennnndddd, in which case it refers to the last
element of the listbox. This command returns an empty
string
_p_a_t_h_N_a_m_e ggggeeeetttt _i_n_d_e_x
Return the contents of the listbox element indicated by
_i_n_d_e_x. _I_n_d_e_x must be a non-negative integer (0
corresponds to the first element in the listbox), or it
may also be specified as eeeennnndddd to indicate the last
element in the listbox.
_p_a_t_h_N_a_m_e iiiinnnnsssseeeerrrrtttt _i_n_d_e_x ?_e_l_e_m_e_n_t _e_l_e_m_e_n_t ...?
Insert zero or more new elements in the list just
Page 2 (printed 7/23/95)
lllliiiissssttttbbbbooooxxxx((((nnnn)))) TTTTkkkk (((( )))) lllliiiissssttttbbbbooooxxxx((((nnnn))))
before the element given by _i_n_d_e_x. If _i_n_d_e_x is
specified as eeeennnndddd then the new elements are added to the
end of the list. Returns an empty string.
_p_a_t_h_N_a_m_e nnnneeeeaaaarrrreeeesssstttt _y
Given a y-coordinate within the listbox window, this
command returns the index of the (visible) listbox
element nearest to that y-coordinate.
_p_a_t_h_N_a_m_e ssssccccaaaannnn _o_p_t_i_o_n _a_r_g_s
This command is used to implement scanning on
listboxes. It has two forms, depending on _o_p_t_i_o_n:
_p_a_t_h_N_a_m_e ssssccccaaaannnn mmmmaaaarrrrkkkk _x _y
Records _x and _y and the current view in the |
listbox window; used in conjunction with later |
ssssccccaaaannnn ddddrrrraaaaggggttttoooo commands. Typically this command is |
associated with a mouse button press in the |
widget. It returns an empty string. |
_p_a_t_h_N_a_m_e ssssccccaaaannnn ddddrrrraaaaggggttttoooo _x _y. ||
This command computes the difference between its _x |
and _y arguments and the _x and _y arguments to the |
last ssssccccaaaannnn mmmmaaaarrrrkkkk command for the widget. It then |
adjusts the view by 10 times the difference in |
coordinates. This command is typically associated
with mouse motion events in the widget, to produce
the effect of dragging the list at high speed
through the window. The return value is an empty
string.
_p_a_t_h_N_a_m_e sssseeeelllleeeecccctttt _o_p_t_i_o_n _a_r_g
This command is used to adjust the selection within a
listbox. It has several forms, depending on _o_p_t_i_o_n.
In all of the forms the index eeeennnndddd refers to the last
element in the listbox.
_p_a_t_h_N_a_m_e sssseeeelllleeeecccctttt aaaaddddjjjjuuuusssstttt _i_n_d_e_x
Locate the end of the selection nearest to the
element given by _i_n_d_e_x, and adjust that end of the
selection to be at _i_n_d_e_x (i.e including but not
going beyond _i_n_d_e_x). The other end of the
selection is made the anchor point for future
sssseeeelllleeeecccctttt ttttoooo commands. If the selection isn't
currently in the listbox, then this command is
identical to the sssseeeelllleeeecccctttt ffffrrrroooommmm widget command.
Returns an empty string.
_p_a_t_h_N_a_m_e sssseeeelllleeeecccctttt cccclllleeeeaaaarrrr
If the selection is in this listbox then it is |
cleared so that none of the listbox's elements are |
selected anymore.
Page 3 (printed 7/23/95)
lllliiiissssttttbbbbooooxxxx((((nnnn)))) TTTTkkkk (((( )))) lllliiiissssttttbbbbooooxxxx((((nnnn))))
_p_a_t_h_N_a_m_e sssseeeelllleeeecccctttt ffffrrrroooommmm _i_n_d_e_x
Set the selection to consist of element _i_n_d_e_x, and
make _i_n_d_e_x the anchor point for future sssseeeelllleeeecccctttt ttttoooo
widget commands. Returns an empty string.
_p_a_t_h_N_a_m_e sssseeeelllleeeecccctttt ttttoooo _i_n_d_e_x
Set the selection to consist of the elements from
the anchor point to element _i_n_d_e_x, inclusive. The
anchor point is determined by the most recent
sssseeeelllleeeecccctttt ffffrrrroooommmm or sssseeeelllleeeecccctttt aaaaddddjjjjuuuusssstttt command in this
widget. If the selection isn't in this widget,
this command is identical to sssseeeelllleeeecccctttt ffffrrrroooommmm. Returns
an empty string.
_p_a_t_h_N_a_m_e ssssiiiizzzzeeee
Returns a decimal string indicating the total number of
elements in the listbox.
_p_a_t_h_N_a_m_e xxxxvvvviiiieeeewwww _i_n_d_e_x
Adjust the view in the listbox so that character |
position _i_n_d_e_x is displayed at the left edge of the |
widget. Returns an empty string. |
_p_a_t_h_N_a_m_e yyyyvvvviiiieeeewwww _i_n_d_e_x ||
Adjust the view in the listbox so that element _i_n_d_e_x is |
displayed at the top of the widget. If _i_n_d_e_x is |
specified as eeeennnndddd it indicates the last element of the |
listbox. Returns an empty string.
DDDDEEEEFFFFAAAAUUUULLLLTTTT BBBBIIIINNNNDDDDIIIINNNNGGGGSSSS
Tk automatically creates class bindings for listboxes that |
give them the following default behavior: |
[1] ||
When button 1 is pressed over a listbox, the element |
underneath the mouse cursor is selected. The mouse can |
be dragged to select a range of elements. |
[2] ||
The ends of the selection can be adjusted by dragging |
with mouse button 1 while the shift key is down; this |
will adjust the end of the selection that was nearest |
to the mouse cursor when button 1 was pressed. |
[3] ||
The view in the listbox can be adjusted by dragging |
with mouse button 2. |
The behavior of listboxes can be changed by defining new |
bindings for individual widgets or by redefining the class |
bindings. In addition, the procedure ttttkkkk____lllliiiissssttttbbbbooooxxxxSSSSiiiinnnngggglllleeeeSSSSeeeelllleeeecccctttt |
Page 4 (printed 7/23/95)
lllliiiissssttttbbbbooooxxxx((((nnnn)))) TTTTkkkk (((( )))) lllliiiissssttttbbbbooooxxxx((((nnnn))))
may be invoked to change listbox behavior so that only a |
single element may be selected at once.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
listbox, widget
Page 5 (printed 7/23/95)